// let names: string = "bob";
// names = '';

//1:可以声明一个数据的时候指定数据类型在声明变量后面加 :number 任意用any
//2:可以使用模板字符串连接数据使用 ${}包裹声明变量
//3：声明数组的时候在声明类型后面加number[]、
//4：一个数组多种类型时用中括号包裹且数据按照声明类型排序
let age: number = 20;
let names: string = "张三";
let say: string = `myname is ${names} i'm ${age} old`;

let list: number[] = [1]; //或者
let list1: Array<number> = [1, 2, 3];

let list2: [string, number, boolean] = ["2", 1, true];
list2[1] = 3;

enum color {
  red,
  blue,
  pink,
}
let a: color = color.red;
console.log(a); //a=red

let sure: any = 3;
sure = "nihao";
sure = false;
//sure = false
let list3: any[] = [1, true, undefined];
//表示是一个数组，里面的内容可以是任意类型
list3[1] = 100;

let unusable: undefined = undefined;

declare function create(
  o: object | null | number | string | boolean | undefined
): void;
create({ prop: 0 }); // OK
create(null); // OK
create(42); // Error
create("string"); // Error
create(false); // Error
create(undefined); // Error

let someValue: any = "this is a string";

let strLength: number = (someValue as string).length;

interface SearchParams {
  _limit?: number;
  _page?: number;
  q?: string;
}

interface UserModel extends SearchParams{
  username: string;
  userpwd: string;
  id?: number;
}

interface IUser {
  //现在这里有一个对象   对象有三种操作 新增  查询  删除
  add(user: UserModel): void;
  query(params: any): void;
  delUser(id: number): void;
}

class user implements IUser {
  add(user: UserModel): void {
    throw new Error("Method not implemented.");
  }
  query(params: any): void {
    throw new Error("Method not implemented.");
  }
  delUser(id: number): void {
    throw new Error("Method not implemented.");
  }
}

